/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.Solenoid;

/**
 *
 * @author Administrator
 */
public class DemobotPneumaticSystem {
    public Compressor compressor = new Compressor(1, 12, 1, 1);
    public Solenoid creepyBirdSnakeThing;// = new Solenoid(1);
    public Solenoid fillValve = new Solenoid(1);
    public Solenoid dumpValve = new Solenoid(2);
    public Solenoid fireValve1 = new Solenoid(3);
    public Solenoid fireValve2 = new Solenoid(4);
    public boolean compressorOn;
    public boolean fillValveOn;
    public boolean dumpValveOn;
    public boolean fireValve1On;
    public boolean fireValve2On;
    public boolean lightOff;
    private boolean neckExtended = false;

    private DemobotPneumaticSystem(){
    }

    private static DemobotPneumaticSystem m_Instance;
    public static DemobotPneumaticSystem getInstance(){
        if(null == m_Instance){
            m_Instance = new DemobotPneumaticSystem();
        }
        return m_Instance;
    }

   public void updateCannnonPnematics() {
        Controller.getInstance().currentState.UpdatePneumatics();
        if (compressorOn) {
            //compressor.start();
        }
        fillValve.set(fillValveOn);
        dumpValve.set(dumpValveOn);
        fireValve1.set(fireValve1On);
        fireValve2.set(fireValve2On);

    }

    public void updateAnimatronic() {
        Controller MyController = Controller.getInstance();
        //MyController.compressorOn = !MyController.getCompressorOff();
        if (compressorOn) {
            compressor.start();
            if (MyController.getExtendNeckButton()) {
                neckExtended = true;
            }
            if (MyController.getRetractNeckButton()) {
                neckExtended = false;
            }
        }
        creepyBirdSnakeThing.set(neckExtended);
    }

    public void updateTShirtCannon() {
        Controller MyController = Controller.getInstance();
        MyController.updateCannonState();
        updateCannnonPnematics();
        MyController.updateCannonSmartDashboard();
    }

}


